package com.xu.demo.events;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;

@Component
public class MyEventPublisher {

    @Autowired
    private ApplicationEventPublisher publisher;

    public void publishEvent() {
        publisher.publishEvent(new EventA("事件A"));
        publisher.publishEvent(new EventB("事件B"));
    }

}
